package com.mes.cloud.util;

/**
 * @author xy
 * @title: CodeUtil
 * @projectName shinho
 * @description: TODO
 * @date 2019/8/115:28
 */
public class CodeUtil {
    
    /**
     * <生成组织编码code>
     * @author xy
     * @date   2019/8/1 15:29 
     * @param  
     * @return 
     */
    public static String randomCode() {
        String randomCode = "";
        // 用字符数组的方式随机
        String model = "0123456789";
        char[] m = model.toCharArray();
        for (int j = 0; j < 6; j++) {
            char c = m[(int) (Math.random() * 10)];
            // 保证六位随机数之间没有重复
//            if(randomCode.contains(c+"")){
//                j--;
//                continue;
//            }
            randomCode = randomCode + c;
        }
        return "XN"+randomCode;
    }
}
